package com.pingba.entity.msg;

import com.pingba.entity.BaseEntity;
import com.pingba.entity.User;

import java.util.Date;

/**
 * Created by Administrator on 2015/11/30 0030.
 */
public class MsgApply extends BaseEntity {
    private long sid;    //int(11) NOT NULL AUTO_INCREMENT COMMENT '流水号',
    private long msgId;    //int(11) NOT NULL COMMENT '消息的id',
    private long msgOwnerId; //'消息发布者的id',
    private long applicantId;    //int(11) NOT NULL COMMENT '申请者的id',
    private String applicantName;    //varchar(30) NOT NULL DEFAULT '' COMMENT '申请者的用户名',
    private String applicantHeadUrl;    //varchar(300) DEFAULT NULL COMMENT '申请者的头像url地址',
    private String applicantContent;    //varchar(50) DEFAULT NULL COMMENT '申请者的留言内容',
    private int status;    //int(4) NOT NULL COMMENT '状态信息， 0表示申请，1表示同意，2表示拒绝',
    private long applyTime;    //bigint(15) NOT NULL COMMENT '申请时间',
    private long handleTime;    //bigint(15) NOT NULL COMMENT '处理时间',
    private boolean readed;     //varchar(1) COMMENT'消息拥有者是否已经读取过消息'
    public static final int ApplyDefault = 0;
    public static final int ApplyAgree = 1;
    public static final int ApplyRefuse = 2;


    public static MsgApply getTemplate(User user, long msgId, long msgOwnerId,String applicantContent) {
        MsgApply template = new MsgApply();
        template.setMsgId(msgId);
        template.setMsgOwnerId(msgOwnerId);
        template.setApplicantContent(applicantContent);
        template.setApplicantHeadUrl(user.getHeadUrl());
        template.setApplicantId(user.getSid());
        template.setApplicantName(user.getNickName());
        template.setReaded(false);
        template.setStatus(ApplyDefault);
        template.setApplyTime(new Date().getTime());
        return template;
    }

    public boolean isReaded() {
        return readed;
    }

    public void setReaded(boolean readed) {
        this.readed = readed;
    }

    public long getMsgOwnerId() {
        return msgOwnerId;
    }

    public void setMsgOwnerId(long msgOwnerId) {
        this.msgOwnerId = msgOwnerId;
    }

    public String getApplicantContent() {
        return applicantContent;
    }

    public void setApplicantContent(String applicantContent) {
        this.applicantContent = applicantContent;
    }

    public String getApplicantHeadUrl() {
        return applicantHeadUrl;
    }

    public void setApplicantHeadUrl(String applicantHeadUrl) {
        this.applicantHeadUrl = applicantHeadUrl;
    }

    public long getApplicantId() {
        return applicantId;
    }

    public void setApplicantId(long applicantId) {
        this.applicantId = applicantId;
    }

    public String getApplicantName() {
        return applicantName;
    }

    public void setApplicantName(String applicantName) {
        this.applicantName = applicantName;
    }

    public long getApplyTime() {
        return applyTime;
    }

    public void setApplyTime(long applyTime) {
        this.applyTime = applyTime;
    }

    public long getHandleTime() {
        return handleTime;
    }

    public void setHandleTime(long handleTime) {
        this.handleTime = handleTime;
    }

    public long getMsgId() {
        return msgId;
    }

    public void setMsgId(long msgId) {
        this.msgId = msgId;
    }

    public long getSid() {
        return sid;
    }

    public void setSid(long sid) {
        this.sid = sid;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }
}
